package com.douqu.game.activity.entity.camp;

import com.douqu.game.core.config.activity.CampRobotConfig;
import com.douqu.game.core.e.E_MatchType;
import com.douqu.game.core.entity.activity.MatchBaseInfo;

public class MatchTempObject {

    private E_MatchType matchType;

    private boolean ready;

    /**
     * 在游戏中并且没有在战斗中才是空闲
     * 不在线或在战斗中都不是空闲
     */
    private boolean free;

    private MatchBaseInfo baseInfo;

    public MatchTempObject()
    {
        baseInfo = new MatchBaseInfo();
    }

    public MatchTempObject(E_MatchType matchType, CampPlayer campPlayer)
    {
        this.matchType = matchType;

        this.baseInfo = new MatchBaseInfo(campPlayer.getPlayerBase());
    }

    public MatchTempObject(CampRobotConfig robotConfig)
    {
        this.matchType = E_MatchType.ROBOT;
        this.ready = true;

        this.baseInfo = new MatchBaseInfo(robotConfig);
    }

//    public MatchTempObject(CampRobotConfig robotConfig, int winRate)
//    {
//        this.matchType = E_MatchType.ROBOT;
//
//        this.baseInfo = new MatchBaseInfo(robotConfig, winRate);
//    }


//    public void sendMatchSuccess(String teamIndex, MatchBaseInfo target)
//    {
//        if(baseInfo.getServerId() == 0)
//            return;
//
//        MainServerInfo mainServerInfo = GameServer.getInstance().getMainServerInfo(baseInfo.getServerId());
//        if(mainServerInfo == null)
//        {
//            LogUtils.error("玩家的游戏主服为空 -> " + baseInfo);
//            return;
//        }
//
//        mainServerInfo.sendMatchSuccess(teamIndex, baseInfo.getObjectIndex(), matchType, target);
//    }


    public boolean isRealPlayer()
    {
        return matchType == E_MatchType.PLAYER;
    }


    public boolean isReady() {
        return ready;
    }

    public void setReady(boolean ready) {
        this.ready = ready;
    }

    public boolean isFree() {
        return free;
    }

    public void setFree(boolean free) {
        this.free = free;
    }

    public E_MatchType getMatchType() {
        return matchType;
    }

    public void setMatchType(E_MatchType matchType) {
        this.matchType = matchType;
    }


    public MatchBaseInfo getBaseInfo() {
        return baseInfo;
    }

    public void setBaseInfo(MatchBaseInfo baseInfo) {
        this.baseInfo = baseInfo;
    }

    @Override
    public String toString() {
        return "{" +
                "matchType=" + matchType +
                ", ready=" + ready +
                ", free=" + free +
                ", baseInfo=" + baseInfo +
                '}';
    }
}